package com.sl.core.engine.datasource;

import org.anyline.adapter.EnvironmentWorker;
import org.anyline.data.jdbc.datasource.JDBCDataSourceHolder;
import org.anyline.data.transaction.TransactionManage;
import org.anyline.util.ConfigTable;

import javax.sql.DataSource;

public class ProcessJDBCDataSourceHolder extends JDBCDataSourceHolder {

    public static void reg(EnvironmentWorker start) {
        start.regBean("anyline.environment.data.datasource.holder.jdbc", new ProcessJDBCDataSourceHolder());

    }

    @Override
    public String regTransactionManager(String key, DataSource datasource, boolean primary) {
        if(ConfigTable.IS_OPEN_TRANSACTION_MANAGER) {
            TransactionManage.reg(key, new ProcessTransactionManage(key,datasource));
        }
        return key;
    }

}
